package ioc13;


import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class SomeBean implements ApplicationContextAware, BeanNameAware {

    private ApplicationContext ac;
    private String beanName;

    public void doSome(){
        System.out.println("SomeBean.doSome()");
        System.out.println("doSome ac:"+ac);
        System.out.println("beanName = " + beanName);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("SomeBean.setApplicationContext()");
        this.ac=applicationContext;
    }

    @Override
    public void setBeanName(String beanName) {
        System.out.println("SomeBean.setBeanName()");
        this.beanName=beanName;
    }
}
